﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:aj="clr-namespace:Common.Utility.AJ;assembly=Common"
    xmlns:ajConverters="clr-namespace:Common.Utility.AJ.Converters;assembly=Common"
    xmlns:commonConverter="clr-namespace:Common.Converters;assembly=Common"
    xmlns:converter="clr-namespace:AWSV2.Converter"
    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
    xmlns:local="clr-namespace:AWSV2.Views"
    xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
    xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
    xmlns:mde="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
    xmlns:s="https://github.com/canton7/Stylet"
    xmlns:sc="clr-namespace:AWSV2.Services"
    xmlns:st="clr-namespace:AWSV2.Controls"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    xmlns:tplLocal="clr-namespace:AWSV2.ViewModels.ShellViewHomeTemplate"
    xmlns:vm="clr-namespace:AWSV2.ViewModels">
    <commonConverter:DeviceNotifyConverter x:Key="instrumentDeviceIconCvt" HiddenWhenOnline="True" />
    <commonConverter:HomeDateGridSummaryFilterConverter x:Key="homeDGSumFilter" />
    <commonConverter:IListCollectionCountToBoolConverter x:Key="listCountToBoolean" />
    <converter:DeviceNoticeIconConverter x:Key="deviceIconConverter" />
    <commonConverter:NumberToStringConverter x:Key="badgeNumberFormatConverter" DisplayMax="99" />
    <commonConverter:BooleanMapConverter
        x:Key="datagridVisibleConverter"
        FalseValue="{x:Static Visibility.Visible}"
        TrueValue="{x:Static Visibility.Collapsed}" />
    <commonConverter:BooleanMapConverter
        x:Key="chartVisibleConverter"
        FalseValue="{x:Static Visibility.Hidden}"
        TrueValue="{x:Static Visibility.Visible}" />
    <SolidColorBrush x:Key="transparent" Color="Transparent" />
    <commonConverter:BooleanMapConverter
        x:Key="tabItemBackgroundConverter"
        FalseValue="{StaticResource transparent}"
        TrueValue="{StaticResource MaterialDesignPaper}" />
    <commonConverter:BooleanMapConverter
        x:Key="labStateColorConverter"
        FalseValue="{StaticResource AJRed}"
        TrueValue="{StaticResource AJGreen}" />
    <commonConverter:BooleanMapConverter
        x:Key="manualWeightBtnsVisibleConverter"
        FalseValue="{x:Static Visibility.Collapsed}"
        TrueValue="{x:Static Visibility.Visible}" />
    <commonConverter:BooleanMapConverter
        x:Key="commonWeightBtnsVisibleConverter"
        FalseValue="{x:Static Visibility.Visible}"
        TrueValue="{x:Static Visibility.Collapsed}" />
    <converter:WeighingModeToBoolConverter x:Key="weighingModeConveter" />
    <converter:WeighingControlToBoolConverter x:Key="weighingControlConverter" />
    <converter:WeighingControlToVisibleConverter x:Key="weighingControlVisibleConverter" />
    <converter:LPRCameraGratingIndexToColorConverter x:Key="lprCameraGratingIndexToColorConverter" />
    <DataTemplate x:Key="HomeMonitorDataTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="3*" />
                <RowDefinition Height="3" />
                <RowDefinition Height="2*" />
            </Grid.RowDefinitions>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition Width="3" />
                    <ColumnDefinition Width="1.2*" />
                </Grid.ColumnDefinitions>

                <Grid Margin="4">
                    <Border
                        Padding="4"
                        Background="{StaticResource PrimaryHueDarkBrush}"
                        CornerRadius="0">
                        <Border.Effect>
                            <DropShadowEffect
                                BlurRadius="8"
                                Direction="0"
                                Opacity=".4"
                                ShadowDepth="0"
                                Color="{StaticResource CommonWhiteColor}" />
                        </Border.Effect>

                    </Border>
                    <tplLocal:MonitorGrid Monitors="{Binding MonitorList}" />
                </Grid>

                <GridSplitter
                    Grid.Column="1"
                    Width="3"
                    VerticalAlignment="Stretch"
                    Background="Transparent"
                    ResizeBehavior="PreviousAndNext"
                    ResizeDirection="Columns" />
                <Grid Grid.Column="2" Margin="4">
                    <Border
                        VerticalAlignment="Stretch"
                        Background="{StaticResource PrimaryHueDarkBrush}"
                        CornerRadius="0"
                        DockPanel.Dock="Top"
                        FocusVisualStyle="{x:Null}">
                        <Border.Effect>
                            <DropShadowEffect
                                BlurRadius="8"
                                Direction="0"
                                Opacity=".4"
                                ShadowDepth="0"
                                Color="{StaticResource CommonWhiteColor}" />
                        </Border.Effect>


                    </Border>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="3*" />
                            <RowDefinition Height="2*" />
                        </Grid.RowDefinitions>
                        <ScrollViewer HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <ContentControl
                                Content="{Binding WeighFormVM}"
                                FocusVisualStyle="{x:Null}"
                                Focusable="False" />
                            <!--<StackPanel>
            <Grid Margin="0,8,0,8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <DockPanel>

                    <Label
                        MinWidth="120"
                        Margin="8,0,8,0"
                        VerticalAlignment="Center"
                        HorizontalContentAlignment="Right"
                        Content="货物净重的我" />
                    <TextBox HorizontalAlignment="Stretch" md:TextFieldAssist.TextFieldCornerRadius="0" />
                </DockPanel>

                <DockPanel Grid.Column="1">

                    <Label
                        MinWidth="120"
                        Margin="8,0,8,0"
                        VerticalAlignment="Center"
                        HorizontalContentAlignment="Right"
                        Content="货物" />
                    <TextBox HorizontalAlignment="Stretch" md:TextFieldAssist.TextFieldCornerRadius="0" />
                </DockPanel>
            </Grid>
            <Grid Margin="0,8,0,8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <DockPanel>

                    <Label
                        MinWidth="120"
                        Margin="8,0,8,0"
                        VerticalAlignment="Center"
                        HorizontalContentAlignment="Right"
                        Content="货物" />
                    <TextBox HorizontalAlignment="Stretch" md:TextFieldAssist.TextFieldCornerRadius="0" />
                </DockPanel>

                <DockPanel Grid.Column="1">

                    <Label
                        MinWidth="120"
                        Margin="8,0,8,0"
                        VerticalAlignment="Center"
                        HorizontalContentAlignment="Right"
                        Content="货物" />
                    <TextBox HorizontalAlignment="Stretch" md:TextFieldAssist.TextFieldCornerRadius="0" />
                </DockPanel>
            </Grid>
        </StackPanel>-->
                        </ScrollViewer>

                        <Border
                            Grid.Row="1"
                            BorderBrush="{StaticResource MaterialDesignPaper}"
                            BorderThickness="0,1,0,0">
                            <DockPanel>

                                <StackPanel HorizontalAlignment="Center" DockPanel.Dock="Top">

                                    <Border>

                                        <Grid Margin="8">
                                            <!--<Ellipse
                            Width="8"
                            Height="8"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Top"
                            Fill="{Binding StateLabConnected, FallbackValue={StaticResource AJGray}, Converter={StaticResource labStateColorConverter}}" />-->
                                            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                                                <StackPanel Orientation="Horizontal">
                                                    <Label
                                                        VerticalContentAlignment="Center"
                                                        Content="{Binding WeightStr1, FallbackValue=120000}"
                                                        FontSize="42"
                                                        Foreground="{StaticResource MaterialDesignBody}" />
                                                    <Label
                                                        VerticalContentAlignment="Bottom"
                                                        Content="{Binding WeighingUnit, FallbackValue=KG}"
                                                        FontSize="18"
                                                        Foreground="{StaticResource MaterialDesignBody}" />
                                                </StackPanel>
                                                <TextBlock
                                                    FontSize="14"
                                                    Text="{Binding InstrumentDeviceIcon, Converter={StaticResource instrumentDeviceIconCvt}}"
                                                    TextAlignment="Center" />
                                            </StackPanel>

                                        </Grid>

                                    </Border>

                                </StackPanel>

                                <Border
                                    MinHeight="80"
                                    Margin="4"
                                    HorizontalAlignment="Center"
                                    DockPanel.Dock="Top"
                                    Visibility="{Binding ManualPZOrMZBtnsVisible, Converter={StaticResource commonWeightBtnsVisibleConverter}}">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition />
                                        </Grid.ColumnDefinitions>
                                        <StackPanel
                                            Grid.ColumnSpan="2"
                                            HorizontalAlignment="Center"
                                            IsEnabled="{Binding EnableWeighing}"
                                            Orientation="Horizontal"
                                            Visibility="{Binding TwiceWeighing, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">

                                            <Button
                                                Margin="8,0"
                                                Background="{StaticResource AJRed}"
                                                Command="{s:Action ManualRefreshWeighForm}"
                                                Content="清空"
                                                Foreground="{StaticResource AJTabBg}"
                                                Style="{StaticResource ThisPageButtonStyle}" />

                                            <Button
                                                x:Name="btn1"
                                                Margin="8,0"
                                                Background="{StaticResource AJBlue}"
                                                Command="{s:Action FirstWeighing}"
                                                Content="{Binding Btn1Text}"
                                                Foreground="{StaticResource AJTabBg}"
                                                IsEnabled="{Binding EnableWeighing}"
                                                Loaded="{s:Action FirstWeighingLoadedCmd}"
                                                Style="{StaticResource ThisPageButtonStyle}" />
                                            <Button
                                                x:Name="btn2"
                                                Margin="8,0"
                                                Background="{StaticResource AJBlue}"
                                                Command="{s:Action SecondWeighing}"
                                                Content="{Binding Btn2Text}"
                                                Foreground="{StaticResource AJTabBg}"
                                                IsEnabled="{Binding EnableWeighing}"
                                                Loaded="{s:Action SecondWeighingLoadedCmd}"
                                                Style="{StaticResource ThisPageButtonStyle}" />
                                            <Button
                                                Margin="8,0"
                                                Background="{StaticResource AJBlue}"
                                                Command="{s:Action WeighWithUpdateCar}"
                                                Content="存 皮"
                                                Foreground="{StaticResource AJTabBg}"
                                                IsEnabled="{Binding EnableWeighing}"
                                                Style="{StaticResource ThisPageButtonStyle}"
                                                Visibility="{Binding WeighingControl, Converter={StaticResource weighingControlVisibleConverter}, ConverterParameter=Hand}" />

                                        </StackPanel>
                                        <Button
                                            Margin="8,0"
                                            md:ElevationAssist.Elevation="Dp8"
                                            Background="{StaticResource AJRed}"
                                            Command="{s:Action ManualRefreshWeighForm}"
                                            Content="清空"
                                            Foreground="{StaticResource AJTabBg}"
                                            Style="{StaticResource ThisPageButtonStyle}"
                                            Visibility="{Binding TwiceWeighing, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}" />

                                        <Button
                                            x:Name="btn0"
                                            Grid.Column="1"
                                            Margin="8,0"
                                            Background="{StaticResource AJBlue}"
                                            Command="{s:Action OnceWeighing}"
                                            Content="{Binding Btn3Text}"
                                            Foreground="{StaticResource AJTabBg}"
                                            IsEnabled="{Binding EnableWeighing}"
                                            Loaded="{s:Action OnceWeighingLoadedCmd}"
                                            Style="{StaticResource ThisPageButtonStyle}"
                                            Visibility="{Binding TwiceWeighing, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}" />
                                    </Grid>
                                </Border>

                                <Border
                                    MinHeight="80"
                                    Margin="4"
                                    HorizontalAlignment="Center"
                                    DockPanel.Dock="Top"
                                    Visibility="{Binding ManualPZOrMZBtnsVisible, Converter={StaticResource manualWeightBtnsVisibleConverter}}">
                                    <Grid>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition />
                                                <ColumnDefinition />
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>

                                            <Button
                                                Margin="8,0"
                                                Background="{StaticResource AJRed}"
                                                Command="{s:Action ManualRefreshWeighForm}"
                                                Content="清空"
                                                Foreground="{StaticResource AJTabBg}"
                                                Style="{StaticResource ThisPageButtonStyle}" />
                                            <Button
                                                Grid.Column="1"
                                                Margin="8,0"
                                                Background="{StaticResource AJBlue}"
                                                Command="{s:Action FirstWeighing}"
                                                Content="{Binding ManualMZText}"
                                                Foreground="{StaticResource AJTabBg}"
                                                IsEnabled="{Binding EnableWeighing}"
                                                Style="{StaticResource ThisPageYellowButtonStyle}" />

                                            <Button
                                                Grid.Column="2"
                                                Margin="8,0"
                                                Background="{StaticResource AJBlue}"
                                                Command="{s:Action SetPZCmd}"
                                                Content="{Binding ManualPZText}"
                                                Foreground="{StaticResource AJTabBg}"
                                                IsEnabled="{Binding EnableWeighing}"
                                                Style="{StaticResource ThisPageOrangeButtonStyle}" />

                                        </Grid>
                                    </Grid>
                                </Border>

                                <ListBox
                                    Padding="2"
                                    md:ListBoxItemAssist.ShowSelection="False"
                                    DockPanel.Dock="Bottom"
                                    Foreground="{StaticResource MaterialDesignBody}"
                                    ItemsSource="{Binding LogContent}"
                                    ScrollViewer.VerticalScrollBarVisibility="Auto">
                                    <i:Interaction.Behaviors>
                                        <sc:ListBoxScrollToBottomBehavior />
                                    </i:Interaction.Behaviors>
                                    <ListBox.ItemContainerStyle>
                                        <Style TargetType="ListBoxItem">
                                            <Setter Property="HorizontalAlignment" Value="Center" />
                                            <Setter Property="Focusable" Value="False" />
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="ListBoxItem">
                                                        <Border
                                                            Padding="4"
                                                            Background="Transparent"
                                                            SnapsToDevicePixels="True">
                                                            <ContentPresenter />
                                                        </Border>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </ListBox.ItemContainerStyle>

                                </ListBox>
                            </DockPanel>
                        </Border>

                    </Grid>
                </Grid>

            </Grid>

            <GridSplitter
                Grid.Row="1"
                Height="3"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Top"
                Background="Transparent"
                ResizeBehavior="PreviousAndNext" />

            <Grid Grid.Row="2" Margin="4">
                <Border Background="{StaticResource PrimaryHueDarkBrush}" CornerRadius="0">
                    <Border.Effect>
                        <DropShadowEffect
                            BlurRadius="8"
                            Direction="0"
                            Opacity=".4"
                            ShadowDepth="0"
                            Color="{StaticResource CommonWhiteColor}" />
                    </Border.Effect>

                </Border>
                <md:DialogHost IsOpen="{Binding DataGridLoading}" OverlayBackground="{x:Null}">
                    <md:DialogHost.DialogContent>
                        <Border
                            Margin="16"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center">
                            <StackPanel>
                                <ProgressBar
                                    Width="32"
                                    Height="32"
                                    HorizontalAlignment="Center"
                                    md:ElevationAssist.Elevation="Dp2"
                                    IsIndeterminate="True"
                                    Style="{StaticResource MaterialDesignCircularProgressBar}"
                                    Value="0" />
                                <TextBlock
                                    Margin="4"
                                    Text="加载中..."
                                    TextAlignment="Center" />
                            </StackPanel>

                        </Border>
                    </md:DialogHost.DialogContent>
                    <Grid>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="1*" />
                        </Grid.ColumnDefinitions>


                        <Border BorderBrush="{StaticResource MaterialDesignPaper}" BorderThickness="0,0,0.5,0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="3*" />
                                    <RowDefinition Height="1*" />
                                </Grid.RowDefinitions>
                                <TabControl SelectionChanged="{s:Action TabsSelectionChanged}" TabStripPlacement="Left">
                                    <TabItem Background="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsSelected, Converter={StaticResource tabItemBackgroundConverter}}" Tag="IsFinish_1">
                                        <TabItem.Header>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock FontSize="12" Text="交易数据" />
                                                <TextBlock FontSize="12" Text="(" />
                                                <TextBlock FontSize="12" Text="{Binding TabSummary.FinishCount, Converter={StaticResource badgeNumberFormatConverter}}" />
                                                <TextBlock FontSize="12" Text=")" />
                                            </StackPanel>
                                        </TabItem.Header>
                                    </TabItem>
                                    <TabItem
                                        Background="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsSelected, Converter={StaticResource tabItemBackgroundConverter}}"
                                        IsSelected="True"
                                        Tag="IsFinish_0">
                                        <TabItem.Header>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock FontSize="12" Text="临时数据" />
                                                <TextBlock FontSize="12" Text="(" />
                                                <TextBlock FontSize="12" Text="{Binding TabSummary.UnFinishCount, Converter={StaticResource badgeNumberFormatConverter}}" />
                                                <TextBlock FontSize="12" Text=")" />
                                            </StackPanel>
                                        </TabItem.Header>
                                    </TabItem>
                                    <TabItem Background="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsSelected, Converter={StaticResource tabItemBackgroundConverter}}" Tag="{StaticResource TrueValue}">
                                        <TabItem.Header>
                                            <TextBlock FontSize="12" Text="车辆重量曲线" />
                                        </TabItem.Header>
                                    </TabItem>
                                </TabControl>

                                <StackPanel Grid.Row="1" VerticalAlignment="Bottom">
                                    <Button Command="{s:Action DeleteSelectedRows}" Visibility="{Binding CurrentUserName, Converter={StaticResource permissionConverter}, ConverterParameter=删除列表}">
                                        <StackPanel Orientation="Horizontal">
                                            <md:PackIcon
                                                Width="18"
                                                Height="18"
                                                Margin="0,0,8,0"
                                                VerticalAlignment="Center"
                                                Kind="DeleteOutline" />
                                            <TextBlock
                                                VerticalAlignment="Center"
                                                FontSize="14"
                                                Text="删除" />
                                        </StackPanel>
                                    </Button>
                                    <Button
                                        x:Name="Btn_FastPopup"
                                        Command="{s:Action ToggleFasePopup}"
                                        CommandParameter="{StaticResource TrueValue}">
                                        <StackPanel Orientation="Horizontal">
                                            <md:PackIcon
                                                Margin="0,0,8,0"
                                                VerticalAlignment="Center"
                                                Kind="CogOutline" />
                                            <TextBlock
                                                VerticalAlignment="Center"
                                                FontSize="14"
                                                Text="快捷" />
                                        </StackPanel>
                                    </Button>
                                </StackPanel>

                            </Grid>

                        </Border>

                        <Grid Grid.Column="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="1*" />
                                <RowDefinition Height="60" />
                            </Grid.RowDefinitions>
                            <Border
                                Margin="1,0,0,0"
                                HorizontalAlignment="Left"
                                BorderBrush="{StaticResource MaterialDesignPaper}"
                                BorderThickness="1,0,0,0">
                                <Border.Effect>
                                    <DropShadowEffect
                                        BlurRadius="6"
                                        Direction="0"
                                        Opacity="0.6"
                                        ShadowDepth="0"
                                        Color="{StaticResource CommonWhiteColor}" />

                                </Border.Effect>
                            </Border>

                            <Grid Visibility="{Binding ShowWeightLineChart, Converter={StaticResource datagridVisibleConverter}}">

                                <DataGrid
                                    x:Name="DG_WeightRecord"
                                    Width="Auto"
                                    Margin="4,0,0,4"
                                    AlternationCount="2"
                                    AutoGenerateColumns="True"
                                    AutoGeneratingColumn="{s:Action DataGridColumnAutoGeneratingHandle}"
                                    Background="{StaticResource PrimaryHueDarkBrush}"
                                    CanUserAddRows="False"
                                    CanUserDeleteRows="False"
                                    CanUserReorderColumns="True"
                                    CanUserResizeColumns="True"
                                    CanUserResizeRows="True"
                                    CanUserSortColumns="True"
                                    Foreground="{StaticResource MaterialDesignBody}"
                                    GridLinesVisibility="All"
                                    HorizontalScrollBarVisibility="Auto"
                                    IsReadOnly="True"
                                    ItemsSource="{Binding RecordDT}"
                                    Loaded="{s:Action WeightRecordDataGridLoaded}"
                                    MouseDoubleClick="{s:Action DataGridCellDoubleClickHandle}"
                                    RowHeaderWidth="0"
                                    SelectedItem="{Binding SelectedRecrod}"
                                    SelectionMode="Single"
                                    SelectionUnit="FullRow">

                                    <!--<DataGrid.ColumnHeaderStyle>
    <Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="DataGridColumnHeader">
        <Setter Property="Background" Value="{StaticResource AJDataGridColumnHeaderBackground}" />
    </Style>
</DataGrid.ColumnHeaderStyle>-->
                                    <DataGrid.Columns>
                                        <DataGridTemplateColumn>
                                            <DataGridTemplateColumn.Header>
                                                <CheckBox
                                                    Checked="{s:Action AllRowCheckedChangedHandle}"
                                                    Loaded="{s:Action AllRowCheckBox_Loaded}"
                                                    Unchecked="{s:Action AllRowCheckedChangedHandle}" />
                                            </DataGridTemplateColumn.Header>
                                            <DataGridTemplateColumn.CellTemplate>
                                                <DataTemplate>
                                                    <CheckBox
                                                        Checked="{s:Action RowCheckedChangedHandle}"
                                                        IsChecked="{Binding 选择, Mode=TwoWay}"
                                                        Unchecked="{s:Action RowCheckedChangedHandle}" />
                                                </DataTemplate>
                                            </DataGridTemplateColumn.CellTemplate>
                                            <DataGridTemplateColumn.HeaderStyle>
                                                <Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="{x:Type DataGridColumnHeader}">
                                                    <Setter Property="HorizontalContentAlignment" Value="Center" />
                                                </Style>
                                            </DataGridTemplateColumn.HeaderStyle>
                                        </DataGridTemplateColumn>
                                    </DataGrid.Columns>
                                    <DataGrid.ContextMenu>
                                        <ContextMenu>
                                            <MenuItem
                                                Click="{s:Action Reprint}"
                                                Header="补充打印"
                                                IsEnabled="{Binding EnablePrintSelected}"
                                                Visibility="{Binding CurrentUserName, Converter={StaticResource permissionConverter}, ConverterParameter=补打选中}" />
                                            <MenuItem
                                                Click="{s:Action UpdateSelected}"
                                                Header="修改磅单"
                                                Visibility="{Binding CurrentUserName, Converter={StaticResource permissionConverter}, ConverterParameter=修改选中}" />
                                            <MenuItem
                                                Click="{s:Action InsertItem}"
                                                Header="手工制单"
                                                IsEnabled="{Binding EnableInsertItem}"
                                                Visibility="{Binding CurrentUserName, Converter={StaticResource permissionConverter}, ConverterParameter=手工制单}" />
                                            <MenuItem
                                                Click="{s:Action OpenPicFolder}"
                                                Header="查看图片"
                                                Visibility="{Binding CurrentUserName, Converter={StaticResource permissionConverter}, ConverterParameter=查询列表}" />
                                            <MenuItem
                                                Click="{s:Action OpenWeighLineChartDialog}"
                                                Header="查看重量曲线"
                                                Visibility="{Binding CurrentUserName, Converter={StaticResource permissionConverter}, ConverterParameter=查询列表}" />
                                            <!--<MenuItem
            Click="{s:Action DeleteSelected}"
            Header="作废记录"
            IsEnabled="{Binding EnableDeleteSelected}" />-->
                                            <!--<MenuItem Header="筛选">
            <MenuItem
                Command="{s:Action QueryList}"
                CommandParameter="IsFinish_0"
                Header="未完成" />
            <MenuItem
                Command="{s:Action QueryList}"
                CommandParameter="IsFinish_1"
                Header="已完成" />
            <MenuItem
                Command="{s:Action QueryList}"
                CommandParameter="IsFinish_"
                Header="全部" />
        </MenuItem>
        <MenuItem Header="统计">
            <MenuItem
                Command="{s:Action QueryList}"
                CommandParameter="DateRange_0"
                Header="当天" />
            <MenuItem
                Command="{s:Action QueryList}"
                CommandParameter="DateRange_7"
                Header="7天" />
            <MenuItem
                Command="{s:Action QueryList}"
                CommandParameter="DateRange_30"
                Header="30天" />
            <MenuItem
                Command="{s:Action QueryList}"
                CommandParameter="DateRange_"
                Header="全部" />
        </MenuItem>-->
                                        </ContextMenu>
                                    </DataGrid.ContextMenu>
                                </DataGrid>

                            </Grid>


                            <Grid Visibility="{Binding ShowWeightLineChart, Converter={StaticResource chartVisibleConverter}}">
                                <lvc:CartesianChart
                                    Series="{Binding WeightLineChart.Series}"
                                    XAxes="{Binding WeightLineChart.Labels}"
                                    YAxes="{Binding WeightLineChart.YAxes}" />
                            </Grid>
                            <Grid Grid.Row="1">
                                <StackPanel
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Center"
                                    Orientation="Horizontal">
                                    <ItemsControl ItemsSource="{Binding WarningIcons}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <WrapPanel IsItemsHost="True" Orientation="Horizontal" />
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <md:PackIcon
                                                    Width="24"
                                                    Height="24"
                                                    Margin="4,0"
                                                    VerticalAlignment="Center"
                                                    Cursor="Hand"
                                                    Foreground="{Binding Online, Converter={StaticResource labStateColorConverter}}"
                                                    Kind="{Binding Icon}"
                                                    ToolTipService.InitialShowDelay="600">
                                                    <md:PackIcon.ToolTip>
                                                        <MultiBinding Converter="{StaticResource deviceIconConverter}">
                                                            <Binding Path="Online" />
                                                            <Binding Path="Key" />
                                                        </MultiBinding>
                                                    </md:PackIcon.ToolTip>
                                                </md:PackIcon>

                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                    </ItemsControl>
                                    <Label
                                        Margin="8,0"
                                        VerticalAlignment="Center"
                                        Content="{Binding WeighName1, FallbackValue=地磅名称}"
                                        Foreground="{StaticResource MaterialDesignBody}" />
                                </StackPanel>
                                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                                    <StackPanel Orientation="Horizontal">
                                        <StackPanel.Resources>
                                            <Style TargetType="TextBlock">
                                                <Setter Property="Foreground" Value="{StaticResource AJTabItemForeground}" />
                                                <Setter Property="FontSize" Value="12" />
                                            </Style>
                                        </StackPanel.Resources>
                                        <TextBlock Text="共计：" />
                                        <TextBlock Text="毛重" />
                                        <TextBlock Text="{Binding DataGridSummary.Mz}" />
                                        <TextBlock Text="{Binding WeighingUnit, FallbackValue=KG}" />
                                        <TextBlock Margin="24,0,0,0" Text="皮重" />
                                        <TextBlock Text="{Binding DataGridSummary.Pz}" />
                                        <TextBlock Text="{Binding WeighingUnit, FallbackValue=KG}" />
                                        <TextBlock Margin="24,0,0,0" Text="净重" />
                                        <TextBlock Text="{Binding DataGridSummary.Jz}" />
                                        <TextBlock Text="{Binding WeighingUnit, FallbackValue=KG}" />
                                        <TextBlock Margin="24,0,0,0" Text="记录" />
                                        <TextBlock Text="{Binding DataGridSummary.Count}" />
                                        <TextBlock Text="条" />
                                    </StackPanel>
                                    <StackPanel
                                        Margin="0,8,0,0"
                                        HorizontalAlignment="Center"
                                        Orientation="Horizontal">
                                        <TextBlock
                                            FontSize="12"
                                            FontWeight="Light"
                                            Foreground="{StaticResource AJTabItemForeground}"
                                            TextAlignment="Center">
                                            <TextBlock.Text>
                                                <MultiBinding Converter="{StaticResource homeDGSumFilter}">
                                                    <Binding Path="DataGridSummary.IsFinishFilter" />
                                                    <Binding Path="DataGridSummary.DateFilter" />
                                                </MultiBinding>
                                            </TextBlock.Text>
                                        </TextBlock>
                                    </StackPanel>

                                </StackPanel>
                                <Button
                                    x:Name="Btn_CarQueuePopup"
                                    Height="32"
                                    Margin="0,0,8,0"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    s:View.ActionTarget="{Binding CarQueueConfig}"
                                    Background="#00197d"
                                    Command="{s:Action ToggleCarQueuePopup}"
                                    CommandParameter="{StaticResource TrueValue}"
                                    Foreground="White"
                                    Visibility="{Binding CarQueueConfig.Enable, Converter={StaticResource chartVisibleConverter}}">
                                    排队车辆
                                </Button>
                                <Border
                                    Margin="0,-1,0,0"
                                    VerticalAlignment="Top"
                                    BorderBrush="{StaticResource MaterialDesignPaper}"
                                    BorderThickness="0,1,0,0">
                                    <Border.Effect>
                                        <DropShadowEffect
                                            BlurRadius="6"
                                            Direction="90"
                                            Opacity=".6"
                                            ShadowDepth="0"
                                            Color="{StaticResource CommonWhiteColor}" />

                                    </Border.Effect>
                                </Border>
                            </Grid>
                        </Grid>
                    </Grid>
                </md:DialogHost>

            </Grid>

            <Popup
                Width="480"
                Height="320"
                AllowsTransparency="True"
                HorizontalOffset="4"
                IsOpen="{Binding IsFastPopupOpen}"
                Placement="Right"
                PlacementTarget="{Binding ElementName=Btn_FastPopup}"
                VerticalOffset="-4">
                <Border
                    Margin="8"
                    Background="{StaticResource PrimaryHueDarkBrush}"
                    BorderThickness="0.5">
                    <Border.Effect>
                        <DropShadowEffect
                            BlurRadius="8"
                            Direction="0"
                            Opacity=".4"
                            ShadowDepth="0"
                            Color="{StaticResource CommonWhiteColor}" />
                    </Border.Effect>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*" />
                            <RowDefinition Height="64" />
                        </Grid.RowDefinitions>
                        <Grid>
                            <Border
                                Padding="12"
                                BorderBrush="{StaticResource MaterialDesignPaper}"
                                BorderThickness="0,0,0,0.5">
                                <StackPanel>
                                    <CheckBox
                                        Margin="0,0,0,8"
                                        Content="自动称重"
                                        IsChecked="{Binding WeighingControl, Converter={StaticResource weighingControlConverter}, ConverterParameter=Auto}" />
                                    <CheckBox
                                        Margin="0,0,0,8"
                                        Content="手动称重"
                                        IsChecked="{Binding WeighingControl, Converter={StaticResource weighingControlConverter}, ConverterParameter=Hand}" />
                                    <CheckBox
                                        Margin="0,0,0,8"
                                        Content="按钮称重"
                                        IsChecked="{Binding WeighingControl, Converter={StaticResource weighingControlConverter}, ConverterParameter=Btn}" />
                                </StackPanel>
                            </Border>
                        </Grid>
                        <StackPanel
                            Grid.Row="1"
                            Margin="12,4"
                            HorizontalAlignment="Right"
                            Orientation="Horizontal">
                            <Button
                                MinWidth="100"
                                Background="{x:Null}"
                                BorderBrush="{StaticResource MaterialDesignBody}"
                                BorderThickness="0.5"
                                Command="{s:Action ToggleFasePopup}"
                                CommandParameter="{StaticResource FalseValue}"
                                Content="取 消"
                                Cursor="Hand"
                                Foreground="{StaticResource MaterialDesignBody}" />
                            <Button
                                MinWidth="100"
                                Margin="12,0,0,0"
                                Background="#2a82e4"
                                Command="{s:Action SwitchWeighingControl}"
                                Content="确 认"
                                Cursor="Hand"
                                Foreground="White"
                                IsDefault="True" />
                        </StackPanel>
                    </Grid>
                </Border>

            </Popup>

            <Popup
                Width="480"
                Height="320"
                AllowsTransparency="True"
                HorizontalOffset="4"
                IsOpen="{Binding CarQueueConfig.IsPopupOpen}"
                Placement="Right"
                PlacementTarget="{Binding ElementName=Btn_CarQueuePopup}"
                VerticalOffset="-4">
                <Border
                    Margin="8"
                    Background="{StaticResource PrimaryHueDarkBrush}"
                    BorderThickness="0.5">
                    <Border.Effect>
                        <DropShadowEffect
                            BlurRadius="8"
                            Direction="0"
                            Opacity=".4"
                            ShadowDepth="0"
                            Color="{StaticResource CommonWhiteColor}" />
                    </Border.Effect>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*" />
                            <RowDefinition Height="64" />
                        </Grid.RowDefinitions>
                        <Grid>
                            <Border
                                Padding="12"
                                BorderBrush="{StaticResource MaterialDesignPaper}"
                                BorderThickness="0,0,0,0.5">
                                <ItemsControl ItemsSource="{Binding CarQueueConfig.LPRList}">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <Border
                                                Padding="4"
                                                BorderBrush="{StaticResource MaterialDesignPaper}"
                                                BorderThickness="0,0,0,0.5">
                                                <DockPanel Margin="4">

                                                    <TextBlock
                                                        VerticalAlignment="Center"
                                                        DockPanel.Dock="Left"
                                                        Text="{Binding CarIdentificationPlateResult.CarNo}" />
                                                    <StackPanel
                                                        HorizontalAlignment="Right"
                                                        DockPanel.Dock="Right"
                                                        Orientation="Horizontal">
                                                        <Button
                                                            Height="24"
                                                            Margin="0,0,8,0"
                                                            s:View.ActionTarget="{Binding RelativeSource={RelativeSource AncestorType=ItemsControl}, Path=DataContext.CarQueueConfig}"
                                                            Background="#00197d"
                                                            Command="{s:Action DeQueue}"
                                                            CommandParameter="{Binding}"
                                                            FontSize="12"
                                                            Foreground="White">
                                                            立即上磅
                                                        </Button>
                                                        <Button
                                                            Height="24"
                                                            s:View.ActionTarget="{Binding RelativeSource={RelativeSource AncestorType=ItemsControl}, Path=DataContext.CarQueueConfig}"
                                                            Command="{s:Action RemoveQueue}"
                                                            CommandParameter="{Binding}"
                                                            FontSize="12"
                                                            Foreground="{StaticResource AJRed}">
                                                            取消排队
                                                        </Button>
                                                    </StackPanel>
                                                </DockPanel>
                                            </Border>

                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </ItemsControl>

                            </Border>
                        </Grid>
                        <StackPanel
                            Grid.Row="1"
                            Margin="12,4"
                            HorizontalAlignment="Right"
                            Orientation="Horizontal">
                            <Button
                                Height="32"
                                s:View.ActionTarget="{Binding CarQueueConfig}"
                                Background="{x:Null}"
                                BorderBrush="{StaticResource MaterialDesignBody}"
                                BorderThickness="0.5"
                                Command="{s:Action ToggleCarQueuePopup}"
                                CommandParameter="{StaticResource FalseValue}"
                                Content="关 闭"
                                Cursor="Hand"
                                Foreground="{StaticResource MaterialDesignBody}" />
                        </StackPanel>
                    </Grid>
                </Border>

            </Popup>
        </Grid>

    </DataTemplate>
</ResourceDictionary>